package br.com.dp.dao.entidade;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the reserva database table.
 * 
 */
@Entity
@Table(name="reserva")
@NamedQuery(name="Reserva.findAll", query="SELECT r FROM Reserva r")
public class Reserva implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique=true, nullable=false)
	private int id;

	@Column(nullable=false)
	private byte aceitaCondicoes;

	@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	private Date dataAlteracao;

	@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	private Date dataEfetivacao;

	@Column(nullable=false)
	private int precoTotalReserva;

	@Column(nullable=false)
	private int totalPontos;

	//bi-directional many-to-one association to Cliente
	@ManyToOne
	@JoinColumn(name="idCliente", nullable=false)
	private Cliente cliente;

	//bi-directional many-to-one association to StatusReserva
	@ManyToOne
	@JoinColumn(name="idStatusReserva", nullable=false)
	private StatusReserva statusReserva;

	//bi-directional one-to-one association to ReservaCartao
	@OneToOne(mappedBy="reserva")
	private ReservaCartao reservaCartao;

	//bi-directional many-to-one association to ReservaQuarto
	@OneToMany(mappedBy="reserva")
	private List<ReservaQuarto> reservaQuartos;

	public Reserva() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public byte getAceitaCondicoes() {
		return this.aceitaCondicoes;
	}

	public void setAceitaCondicoes(byte aceitaCondicoes) {
		this.aceitaCondicoes = aceitaCondicoes;
	}

	public Date getDataAlteracao() {
		return this.dataAlteracao;
	}

	public void setDataAlteracao(Date dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public Date getDataEfetivacao() {
		return this.dataEfetivacao;
	}

	public void setDataEfetivacao(Date dataEfetivacao) {
		this.dataEfetivacao = dataEfetivacao;
	}

	public int getPrecoTotalReserva() {
		return this.precoTotalReserva;
	}

	public void setPrecoTotalReserva(int precoTotalReserva) {
		this.precoTotalReserva = precoTotalReserva;
	}

	public int getTotalPontos() {
		return this.totalPontos;
	}

	public void setTotalPontos(int totalPontos) {
		this.totalPontos = totalPontos;
	}

	public Cliente getCliente() {
		return this.cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public StatusReserva getStatusReserva() {
		return this.statusReserva;
	}

	public void setStatusReserva(StatusReserva statusReserva) {
		this.statusReserva = statusReserva;
	}

	public ReservaCartao getReservaCartao() {
		return this.reservaCartao;
	}

	public void setReservaCartao(ReservaCartao reservaCartao) {
		this.reservaCartao = reservaCartao;
	}

	public List<ReservaQuarto> getReservaQuartos() {
		return this.reservaQuartos;
	}

	public void setReservaQuartos(List<ReservaQuarto> reservaQuartos) {
		this.reservaQuartos = reservaQuartos;
	}

	public ReservaQuarto addReservaQuarto(ReservaQuarto reservaQuarto) {
		getReservaQuartos().add(reservaQuarto);
		reservaQuarto.setReserva(this);

		return reservaQuarto;
	}

	public ReservaQuarto removeReservaQuarto(ReservaQuarto reservaQuarto) {
		getReservaQuartos().remove(reservaQuarto);
		reservaQuarto.setReserva(null);

		return reservaQuarto;
	}

}